package com.practice.controller;

import com.practice.service.HelloService;
import com.practice.utils.validator.*;
import com.practice.utils.R;
import com.practice.utils.Constant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: pengshihao
 * @Description:
 * @Date: created in 16:54 2019/9/16
 * @Modified By:
 */

@RestController
@RequestMapping("/v1")
public class UserController {

    @Autowired
    private HelloService helloService;

    @GetMapping("/hello/{name}")
    public R index(@PathVariable("name") String name){
        return helloService.hello(name);
    }

    @GetMapping("/signIn")
    public R login(@RequestParam String openId){
        Assert.isBlank(openId, Constant.OPEN_ID_NULL);
        return R.ok();
    }
}
